1. The Field of the Invention
The present invention relates to data base management, and more specifically, to mechanisms for accessing and editing records of a database across the Internet while maintaining data integrity.
2. The Relevant Technology
Conventional mainframe databases have proven extremely useful and necessary for data management by various entities. Mainframe databases must be extremely reliable and are in many instances capable of handling large transactional loads. One example of such a database management system is the Information Management System (IMS) available from IBM Corp., Armonk, N.Y. An IMS system[s] allows access to one or more databases in order for users to interact with the data maintained on the database. The majority of user access involves transaction. Transactions may involve incorporating business logic into database updates. Integrity and verification of database updates are protected by ensuring that business logic has been applied and that editing rules are confirmed. In this manner, database updates are guaranteed to be correct.
Throughout, reference will be made to an IMS database management system running on a mainframe computer with accompanying middleware acting as World Wide Web server for allowing Internet access to the database. This is an exemplary environment only and the invention presented hereafter will apply to any Internet accessible database or other database in a stateless environment. For example, a web-accessible relational database, such as Oracle 8i, IBM DB2, or Microsoft SQL Server 7.0, would encounter the same problems presented hereafter and could equally make use of the present invention. Furthermore, the present invention provides benefit in any stateless situation when it is unknown at the time of a database request, when, if ever, the requestor will return with modified data for update into the database.
Sensitive information, such as payroll systems, are not allowed to be accessed or updated absent this form of guarantee. For example, in a financial transfer between two accounts, one account is credited and another account is debited. The system must handle this transfer as one unit even though accessing two independent databases. In order to ensure that each database update is correct, this transaction must be verified for both databases in order to confirm and complete the transaction. Otherwise, the transaction is not allowed to proceed.
IMS systems are frequently made accessible over closed networks such as LANs and WANs in order to enable users on the network to make transactions on an enterprise""s database. More recently, IMS systems have been made accessible to users communicating across the Internet to enable user transactions on the database. Such Internet-enabled use provides users physically remote to the enterprise with the ability to transact with the databases.
Generally, these outside users are allowed to access data that does not have critical data elements. Such nonsensitive data need not have business data, database logic, and business rules applied thereto. Nonsensitive data may include, for example, a customer""s name, address file, telephone number etc. Thus, users such as a customer are able to access the database through the Internet and are provided with the ability to alter only nonsensitive data.
Generally, outside users access the IMS system through conventional browser technology. Through the browser, the user may request specific data from the IMS system. In response, the IMS accesses and transmits the nonsensitive information to be displayed by the browser for the user""s review. The user may then access the displayed information, update it according to the user""s needs, and transmit the updated data back to the IMS system.
While standard business database logic and rules need not be applied to nonsensitive information, any modifications to the data must still follow standard integrity, serialization, and locking rules. For instance, conventional locking standards require that when a user retrieves data that is to be updated, the data must be locked so that it cannot be changed until the update is completed. After the update is completed, the data is sent back to the IMS system, which commits the changes to the system. Because the data was locked, the data is maintained internally consistent until the changes are logged and the data is again opened for user access.
An Internet system for accessing data from a database is absent many advantages of a conventional network system. For example, a web user does not necessarily stay connected to the system during a transaction, and the system is not able to track what the user is doing with data downloaded to the web browser. Additionally, the system does not know when a web user intends to enter data or update data, nor does the system know if or when the web user will return any updates or if the web user has terminated a connection with the system. Thus, conventional locking systems are not effective in an Internet environment. A locking mechanism is generally unable to lock data upon transmission of the data to a web browser, because the system does not know when to unlock the data.
A conventional technique known as optimistic locking has been used to eliminate the need for locking data for long periods of time during data transmissions over the web. Optimistic locking assumes that the data need not be locked, because it is not likely that anyone else is going to change the data. Therefore, the data is not locked, but is checked to verify whether anyone has changed any data before the web user makes the update.
Optimistic locking requires a host to remember an initial state of all data sent by the host to the web user. When the web user returns updated data, the host checks the data to verify that the original data sent to the user is still current. If so, the updated data is verified as being based on the current data, and is entered into the system. If the original data has been modified, the update is not allowed to occur, and the user is notified of the modified data.
Optimistic locking mechanisms are very effective in dealing with database updates in certain instances, such as when dealing with relatively few active web users. For example, a host dealing with only ten users at a time can easily accommodate and remember ten initial states. Difficulty arises when a host must dedicate resources to retaining thousands or millions of states. Systems open to Internet access are such an environment, as the web allows millions of users to access an IMS system at any given time. In order to accommodate such vast numbers of web users, a host would be forced to maintain an elaborate state table and dedicate substantial resources to maintaining the state table. Such a burden on a host""s resources may easily exceed what the host is effectively able to manage.
Thus, from the above discussion, it is apparent that it would be advantageous to accommodate Internet-enabled transactions on a database, while retaining the advantages of optimistic locking mechanisms. It would also be advantageous to provide an optimistic locking mechanism that is efficient and highly scalable, in order to accommodate the large numbers of users that may access a database over the Internet. It would similarly be an advantage to provide an optimistic locking mechanism that operates in conjunction with conventional web browsers and with conventional IMS systems. It would be a further advantage to provide an optimistic locking system that is capable of reliably and cost-effectively implementing Internet access of an IMS system.
The apparatus of the present invention has been developed in response to the present state of the art, and in particular, in response to the problems and needs in the art that have not yet been fully solved by currently available data integrity verification and locking mechanisms. Thus, it is an overall objective of the present invention to provide an optimistic locking mechanism which allows Internet access to a database while maintaining data integrity in such a web environment.
The present invention is described as a method, computer program product, and system for client-side optimistic locking in a stateless environment is presented. A database is accessible by a requester. The requestor may be an Internet-enabled application that makes database requests over the Internet, a webserver allowing users to access a database, an application making direct requests to the database over any communications network, such as LAN, WAN, Internet, etc., or any other agent or combination of agents communicating data requests to the database.
It is important that the requestor contain a portion or client that is distributed on a different computer system than contains the database and database management system. This xe2x80x9cclientxe2x80x9d portion will receive and store the state data as explained hereafter. For example, a webserver may communicate with a database management system to access data that is served as HTML pages to a browser using the Internet as a communications network and the Hyper Text Transport Protocol to transfer the accessed data. The xe2x80x9cclientxe2x80x9d portion would be the browser combined with the HTML page. Requestor refers to all components, code, etc. that handles data from a database to a client over a communications network, including the client portion.
In response to a request, the database will send state data showing the state of the data at the time the request was serviced (e.g., received by the database management system). When the requestor desires to change (e.g., update) the requested data in the database, the requestor will send, and the database management system will receive, both the state data and the changed or modified state data (i.e., xe2x80x9cmodified dataxe2x80x9d). In this sense, an optimistic lock is performed on the data that is managed and stored by the client portion of the requester.
The database management system may receive at some future point in time both the state data, representing the previous state of the system at the time of the initial request, and the modified data (i.e., the state data with the desired changes). Upon receipt, the database management system simply checks to see if the state data is the same as the current data in the database. If so, then the client-side optimistic lock succeeded and it is okay to update the database. If it is not the same, then the data has been previously modified since the requestor originally received the state data and the client-side optimistic lock failed.
On major advantage of the client-side optimistic locking mechanism is that all the state data is stored by the client and the database and database management system need to store and manage a minimal amount of information and do not have the added complexity that may frustrate even attempting any form of optimistic locking. This is particularly important when allowing Internet-based access to existing databases using the stateless web protocol, HTTP.
To achieve the foregoing object, and in accordance with the invention as embodied and broadly described herein, one embodiment of an Internet-enabled locking mechanism of the present invention is described herein. The Internet-enabled locking mechanism, in the embodiment to be described and illustrated herein, incorporates a conventional IMS residing on a host computer. The IMS is configured with a memory and a modules including a generic transaction module stored in the memory and executable by a processor. The generic transaction module is configured to retrieve data requested by a web user, referred to herein as an xe2x80x9coriginal data segment,xe2x80x9d from the IMS in response to a search request from the web user.
The modules stored in the memory further include a server-side interface module. The server-side interface module duplicates the original data segment into two identical lines of data segments formatted as a modifiable data segment and a state data segment. The modifiable data segment is displayable to and modifiable by a web, whereas the state data segment, which always accompanies the modifiable data segment, is not displayable to the web user and may not be modified.
When the web user requests data from the database, the modifiable and state data segments are accessed by a server, which incorporates the data segments into a web page format. The thusly formatted modifiable and state data segments are then transmitted over the Internet by the server to the web user, who is able to view the modifiable data segment with a conventional web browser.
The web user may update the modifiable data segment and transmit the modifiable data segment back to the server for entry into the database. The modifiable data segment is sent to the server, in such an instance, and the accompanying state data segmentxe2x80x94which is not modifiedxe2x80x94is also sent, preferably concurrently and transparently. The state data segment remains constant throughout all transmissions of the modifiable and state data segments.
The generic transaction module receives the modifiable and state data segments and compares the state data segment with a current data segment stored in the IMS. The current data segment represents the current state of the original data segment. The generic transaction module determines whether the state data segment and the current data segment are equivalent and, if so, alters the current data segment to reflect the updated modifiable data segment.
If the state data segment and the current data segment are not equivalent, the generic transaction module does not enter the updates from the web user. Instead, the generic transaction module updates the modifiable and state data segments to reflect the current data segment and transmits the modifiable and state data segments to the web user.
Under the present invention, a web user is allowed to update only data segments of a database that are current. Data integrity within the database is thereby maintained. Maintaining database integrity during web transactions is not overly burdensome on a host database system under the present invention, as reference state data segments are maintained external to the host, thereby preserving the host""s resources and allowing for high user scalability. The present invention provides the benefits of optimistic locking to Internet access of databases, and employs conventional browser and server technology in so doing.
These and other objects, features, and advantages of the present invention will become more fully apparent from the following description and appended claims, or may be learned by the practice of the invention as set forth hereinafter.